VERSION 5.00
Object = "{86CF1D34-0C5F-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCT2.OCX"
Object = "{3B7C8863-D78F-101B-B9B5-04021C009402}#1.2#0"; "RICHTX32.OCX"
Begin VB.Form customer 
   Caption         =   "Renewal Subscription Form"
   ClientHeight    =   10950
   ClientLeft      =   60
   ClientTop       =   450
   ClientWidth     =   18960
   LinkTopic       =   "Form1"
   MDIChild        =   -1  'True
   ScaleHeight     =   10950
   ScaleWidth      =   18960
   WindowState     =   2  'Maximized
   Begin VB.TextBox Text14 
      Appearance      =   0  'Flat
      Height          =   375
      Left            =   13800
      TabIndex        =   64
      Top             =   9840
      Width           =   855
   End
   Begin VB.CommandButton Command2 
      Caption         =   "Reset"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Left            =   14760
      TabIndex        =   63
      Top             =   9840
      Width           =   735
   End
   Begin VB.CommandButton Command5 
      Caption         =   "Daily Report"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Left            =   17880
      TabIndex        =   62
      Top             =   8040
      Width           =   1935
   End
   Begin VB.CommandButton Command7 
      Caption         =   "Monthly Report"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Left            =   15960
      TabIndex        =   61
      Top             =   8040
      Width           =   1935
   End
   Begin VB.PictureBox Picture1 
      Appearance      =   0  'Flat
      ForeColor       =   &H80000008&
      Height          =   8415
      Left            =   2280
      ScaleHeight     =   8385
      ScaleWidth      =   13185
      TabIndex        =   15
      Top             =   1320
      Width           =   13215
      Begin VB.Frame Frame1 
         Appearance      =   0  'Flat
         ForeColor       =   &H80000008&
         Height          =   830
         Left            =   9600
         TabIndex        =   65
         Top             =   7460
         Width           =   3375
         Begin VB.ComboBox cmbReprint 
            BeginProperty Font 
               Name            =   "MS Sans Serif"
               Size            =   8.25
               Charset         =   0
               Weight          =   700
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   315
            Left            =   240
            TabIndex        =   67
            Top             =   360
            Width           =   1575
         End
         Begin VB.CommandButton cmdReprint 
            Caption         =   "Policy Detail"
            BeginProperty Font 
               Name            =   "MS Sans Serif"
               Size            =   8.25
               Charset         =   0
               Weight          =   700
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   375
            Left            =   1920
            TabIndex        =   66
            Top             =   320
            Width           =   1335
         End
      End
      Begin VB.PictureBox Picture4 
         Appearance      =   0  'Flat
         ForeColor       =   &H80000008&
         Height          =   735
         Left            =   1200
         ScaleHeight     =   705
         ScaleWidth      =   4185
         TabIndex        =   54
         Top             =   7560
         Width           =   4215
         Begin VB.TextBox Label25 
            Appearance      =   0  'Flat
            Height          =   285
            Left            =   2040
            TabIndex        =   56
            Text            =   "1"
            Top             =   285
            Width           =   495
         End
         Begin VB.CommandButton Command6 
            Caption         =   "Token"
            BeginProperty Font 
               Name            =   "MS Sans Serif"
               Size            =   8.25
               Charset         =   0
               Weight          =   700
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   375
            Left            =   2760
            TabIndex        =   55
            Top             =   240
            Width           =   1095
         End
         Begin VB.Label Label24 
            Caption         =   "Enter Token Number"
            BeginProperty Font 
               Name            =   "MS Sans Serif"
               Size            =   8.25
               Charset         =   0
               Weight          =   700
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   255
            Left            =   120
            TabIndex        =   57
            Top             =   300
            Width           =   1935
         End
      End
      Begin VB.CommandButton Command1 
         Caption         =   "Save"
         BeginProperty Font 
            Name            =   "MS Sans Serif"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   375
         Left            =   12000
         TabIndex        =   36
         Top             =   6600
         Width           =   975
      End
      Begin VB.TextBox Text15 
         Appearance      =   0  'Flat
         Height          =   375
         Left            =   120
         TabIndex        =   35
         Top             =   7920
         Width           =   855
      End
      Begin VB.PictureBox Picture2 
         Appearance      =   0  'Flat
         ForeColor       =   &H80000008&
         Height          =   735
         Left            =   5520
         ScaleHeight     =   705
         ScaleWidth      =   3945
         TabIndex        =   32
         Top             =   7560
         Width           =   3975
         Begin VB.CommandButton Command3 
            Caption         =   "Print"
            BeginProperty Font 
               Name            =   "MS Sans Serif"
               Size            =   8.25
               Charset         =   0
               Weight          =   700
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   375
            Left            =   2640
            TabIndex        =   34
            Top             =   240
            Width           =   1095
         End
         Begin VB.ComboBox Combo1 
            Height          =   315
            Left            =   240
            TabIndex        =   33
            Top             =   240
            Width           =   1935
         End
      End
      Begin VB.CommandButton Command4 
         Caption         =   "Delete"
         BeginProperty Font 
            Name            =   "MS Sans Serif"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   375
         Left            =   240
         TabIndex        =   31
         Top             =   6720
         Width           =   975
      End
      Begin VB.TextBox Text17 
         Alignment       =   1  'Right Justify
         Appearance      =   0  'Flat
         Height          =   375
         Left            =   9600
         TabIndex        =   30
         Text            =   "1"
         Top             =   5640
         Width           =   2535
      End
      Begin VB.TextBox Text16 
         Alignment       =   1  'Right Justify
         Appearance      =   0  'Flat
         Enabled         =   0   'False
         Height          =   375
         Left            =   2880
         TabIndex        =   29
         Top             =   5760
         Width           =   2535
      End
      Begin VB.TextBox Text1 
         Alignment       =   1  'Right Justify
         Appearance      =   0  'Flat
         Height          =   375
         Left            =   2880
         TabIndex        =   28
         Top             =   1080
         Width           =   2535
      End
      Begin VB.TextBox Text2 
         Alignment       =   1  'Right Justify
         Appearance      =   0  'Flat
         Height          =   375
         Left            =   2880
         Locked          =   -1  'True
         TabIndex        =   27
         Top             =   1755
         Width           =   2535
      End
      Begin VB.TextBox Text4 
         Alignment       =   1  'Right Justify
         Appearance      =   0  'Flat
         Height          =   375
         Left            =   2880
         Locked          =   -1  'True
         TabIndex        =   26
         Top             =   2445
         Width           =   2535
      End
      Begin VB.TextBox Text7 
         Alignment       =   1  'Right Justify
         Appearance      =   0  'Flat
         Height          =   375
         Left            =   2880
         Locked          =   -1  'True
         TabIndex        =   25
         Top             =   3120
         Width           =   2535
      End
      Begin VB.TextBox Text8 
         Alignment       =   1  'Right Justify
         Appearance      =   0  'Flat
         Height          =   375
         Left            =   2880
         Locked          =   -1  'True
         TabIndex        =   24
         Top             =   3795
         Width           =   2535
      End
      Begin VB.TextBox Text13 
         Alignment       =   1  'Right Justify
         Appearance      =   0  'Flat
         Height          =   375
         Left            =   2880
         Locked          =   -1  'True
         TabIndex        =   23
         Top             =   5080
         Width           =   2535
      End
      Begin VB.TextBox Text12 
         Alignment       =   1  'Right Justify
         Appearance      =   0  'Flat
         Height          =   375
         Left            =   9600
         Locked          =   -1  'True
         TabIndex        =   22
         Top             =   1080
         Width           =   2535
      End
      Begin VB.TextBox Text11 
         Alignment       =   1  'Right Justify
         Appearance      =   0  'Flat
         Height          =   375
         Left            =   9600
         Locked          =   -1  'True
         TabIndex        =   21
         Top             =   4335
         Width           =   2535
      End
      Begin VB.TextBox Text10 
         Alignment       =   1  'Right Justify
         Appearance      =   0  'Flat
         Height          =   375
         Left            =   2880
         Locked          =   -1  'True
         TabIndex        =   20
         Top             =   4480
         Width           =   2535
      End
      Begin VB.TextBox Text9 
         Alignment       =   1  'Right Justify
         Appearance      =   0  'Flat
         Height          =   375
         Left            =   9600
         Locked          =   -1  'True
         TabIndex        =   19
         Top             =   3690
         Width           =   2535
      End
      Begin VB.TextBox Text6 
         Alignment       =   1  'Right Justify
         Appearance      =   0  'Flat
         Height          =   375
         Left            =   9600
         Locked          =   -1  'True
         TabIndex        =   18
         Top             =   3030
         Width           =   2535
      End
      Begin VB.TextBox Text5 
         Alignment       =   1  'Right Justify
         Appearance      =   0  'Flat
         Height          =   375
         Left            =   9600
         Locked          =   -1  'True
         TabIndex        =   17
         Top             =   2385
         Width           =   2535
      End
      Begin VB.TextBox Text3 
         Alignment       =   1  'Right Justify
         Appearance      =   0  'Flat
         Height          =   375
         Left            =   9600
         Locked          =   -1  'True
         TabIndex        =   16
         Top             =   1725
         Width           =   2535
      End
      Begin MSComCtl2.DTPicker DTPicker1 
         Height          =   375
         Left            =   9600
         TabIndex        =   37
         Top             =   4980
         Width           =   2535
         _ExtentX        =   4471
         _ExtentY        =   661
         _Version        =   393216
         Format          =   88670209
         CurrentDate     =   40048
      End
      Begin VB.Label Label7 
         Caption         =   "Intallment"
         BeginProperty Font 
            Name            =   "MS Sans Serif"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   255
         Left            =   6840
         TabIndex        =   53
         Top             =   3075
         Width           =   2055
      End
      Begin VB.Label Label13 
         Caption         =   "Current In Account"
         BeginProperty Font 
            Name            =   "MS Sans Serif"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   255
         Left            =   6840
         TabIndex        =   52
         Top             =   3745
         Width           =   1695
      End
      Begin VB.Label Label11 
         Caption         =   "Total No. Dues"
         BeginProperty Font 
            Name            =   "MS Sans Serif"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   255
         Left            =   960
         TabIndex        =   51
         Top             =   3135
         Width           =   1695
      End
      Begin VB.Label Label10 
         Caption         =   "Enter Current Date"
         BeginProperty Font 
            Name            =   "MS Sans Serif"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   255
         Left            =   6840
         TabIndex        =   50
         Top             =   5085
         Width           =   2295
      End
      Begin VB.Label Label9 
         Caption         =   "Last Pay"
         BeginProperty Font 
            Name            =   "MS Sans Serif"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   255
         Left            =   6840
         TabIndex        =   49
         Top             =   4415
         Width           =   1095
      End
      Begin VB.Label Label6 
         Caption         =   "Mode of Payment"
         BeginProperty Font 
            Name            =   "MS Sans Serif"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   255
         Left            =   6840
         TabIndex        =   48
         Top             =   2405
         Width           =   1935
      End
      Begin VB.Label Label4 
         Caption         =   "Plan"
         BeginProperty Font 
            Name            =   "MS Sans Serif"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   240
         Left            =   6840
         TabIndex        =   47
         Top             =   1750
         Width           =   1335
      End
      Begin VB.Label Label3 
         Caption         =   "Distributor's Code"
         BeginProperty Font 
            Name            =   "MS Sans Serif"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   255
         Left            =   6840
         TabIndex        =   46
         Top             =   1080
         Width           =   2055
      End
      Begin VB.Label Label8 
         Caption         =   "Fine"
         BeginProperty Font 
            Name            =   "MS Sans Serif"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   255
         Left            =   960
         TabIndex        =   45
         Top             =   5190
         Width           =   1095
      End
      Begin VB.Label Label14 
         Caption         =   "Total Amount"
         BeginProperty Font 
            Name            =   "MS Sans Serif"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   240
         Left            =   960
         TabIndex        =   44
         Top             =   4515
         Width           =   2055
      End
      Begin VB.Label Label12 
         Caption         =   "No. of Dues Paid"
         BeginProperty Font 
            Name            =   "MS Sans Serif"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   255
         Left            =   960
         TabIndex        =   43
         Top             =   3825
         Width           =   1695
      End
      Begin VB.Label Label5 
         Caption         =   "Term"
         BeginProperty Font 
            Name            =   "MS Sans Serif"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   255
         Left            =   960
         TabIndex        =   42
         Top             =   2460
         Width           =   1935
      End
      Begin VB.Label Label2 
         Caption         =   "Name"
         BeginProperty Font 
            Name            =   "MS Sans Serif"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   255
         Left            =   960
         TabIndex        =   41
         Top             =   1770
         Width           =   2175
      End
      Begin VB.Label Label1 
         Caption         =   "Enter the RegNo."
         BeginProperty Font 
            Name            =   "MS Sans Serif"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   255
         Left            =   960
         TabIndex        =   40
         Top             =   1080
         Width           =   1815
      End
      Begin VB.Label Label18 
         Caption         =   "Enter the Fine"
         BeginProperty Font 
            Name            =   "MS Sans Serif"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   255
         Left            =   960
         TabIndex        =   39
         Top             =   5880
         Width           =   1815
      End
      Begin VB.Label Label19 
         Caption         =   "No. Of Dues"
         BeginProperty Font 
            Name            =   "MS Sans Serif"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   255
         Left            =   6840
         TabIndex        =   38
         Top             =   5760
         Width           =   1455
      End
   End
   Begin RichTextLib.RichTextBox RichTextBox1 
      Height          =   375
      Left            =   12360
      TabIndex        =   3
      Top             =   8280
      Width           =   1695
      _ExtentX        =   2990
      _ExtentY        =   661
      _Version        =   393217
      TextRTF         =   $"customer.frx":0000
   End
   Begin VB.PictureBox Picture3 
      Appearance      =   0  'Flat
      ForeColor       =   &H80000008&
      Height          =   855
      Left            =   15480
      ScaleHeight     =   825
      ScaleWidth      =   4545
      TabIndex        =   6
      Top             =   8880
      Visible         =   0   'False
      Width           =   4575
      Begin VB.TextBox Text20 
         Height          =   375
         Left            =   1080
         TabIndex        =   8
         Top             =   360
         Width           =   855
      End
      Begin VB.TextBox Text19 
         Height          =   375
         Left            =   120
         TabIndex        =   7
         Top             =   360
         Width           =   855
      End
      Begin VB.TextBox Text18 
         Height          =   375
         Left            =   2160
         TabIndex        =   9
         Top             =   360
         Width           =   1575
      End
      Begin VB.Label Label28 
         Caption         =   "JVK"
         BeginProperty Font 
            Name            =   "MS Sans Serif"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   255
         Left            =   2640
         TabIndex        =   60
         Top             =   120
         Width           =   495
      End
      Begin VB.Label Label27 
         Caption         =   "Token"
         BeginProperty Font 
            Name            =   "MS Sans Serif"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   255
         Left            =   1200
         TabIndex        =   59
         Top             =   120
         Width           =   615
      End
      Begin VB.Label Label26 
         Caption         =   "CSS"
         BeginProperty Font 
            Name            =   "MS Sans Serif"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   255
         Left            =   240
         TabIndex        =   58
         Top             =   120
         Width           =   495
      End
      Begin VB.Label Label23 
         Caption         =   "<<"
         BeginProperty Font 
            Name            =   "MS Sans Serif"
            Size            =   12
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   255
         Left            =   3960
         TabIndex        =   12
         Top             =   240
         Width           =   375
      End
   End
   Begin RichTextLib.RichTextBox RichTextBox2 
      Height          =   855
      Left            =   7800
      TabIndex        =   10
      Top             =   3720
      Width           =   2655
      _ExtentX        =   4683
      _ExtentY        =   1508
      _Version        =   393217
      Enabled         =   -1  'True
      TextRTF         =   $"customer.frx":0082
   End
   Begin RichTextLib.RichTextBox RichTextBox3 
      Height          =   3735
      Left            =   16080
      TabIndex        =   13
      Top             =   4200
      Width           =   3615
      _ExtentX        =   6376
      _ExtentY        =   6588
      _Version        =   393217
      ScrollBars      =   3
      Appearance      =   0
      TextRTF         =   $"customer.frx":010D
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "Palatino Linotype"
         Size            =   9
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
   End
   Begin MSComCtl2.DTPicker DTPicker2 
      Height          =   375
      Left            =   17280
      TabIndex        =   14
      Top             =   3720
      Width           =   1335
      _ExtentX        =   2355
      _ExtentY        =   661
      _Version        =   393216
      Format          =   88670209
      CurrentDate     =   40182
   End
   Begin VB.Image Image1 
      Height          =   840
      Left            =   6000
      Picture         =   "customer.frx":0193
      Stretch         =   -1  'True
      Top             =   0
      Width           =   960
   End
   Begin VB.Label Label22 
      Caption         =   ">>"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   12
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   255
      Left            =   15600
      TabIndex        =   11
      Top             =   9360
      Width           =   375
   End
   Begin VB.Label Label21 
      Height          =   255
      Left            =   1680
      TabIndex        =   5
      Top             =   9960
      Width           =   1455
   End
   Begin VB.Label Label20 
      Caption         =   "Total Collection:"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   255
      Left            =   120
      TabIndex        =   4
      Top             =   9960
      Width           =   1455
   End
   Begin VB.Label Label17 
      Caption         =   "Label17"
      Height          =   375
      Left            =   18240
      TabIndex        =   2
      Top             =   120
      Width           =   1935
   End
   Begin VB.Label Label16 
      Caption         =   "RENEWAL SUBSCRIPTION RECEIPT"
      BeginProperty Font 
         Name            =   "Times New Roman"
         Size            =   9.75
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   255
      Left            =   8265
      TabIndex        =   1
      Top             =   720
      Width           =   3495
   End
   Begin VB.Label Label15 
      Caption         =   "JEEVAN VAISYA GREEN AGROTECH LLP"
      BeginProperty Font 
         Name            =   "Times New Roman"
         Size            =   14.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Left            =   7065
      TabIndex        =   0
      Top             =   240
      Width           =   5895
   End
End
Attribute VB_Name = "customer"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim c, c1, d, pa, pc As Connection
Dim rs1, rs2 As Recordset
Dim rs3, rs4, rs5, rs6 As Recordset
Dim s(10), cs, p, fd(1000) As String
Dim css, nc, f, suma, sumc As Long
Dim n As Single
Dim day1, d2 As String
Dim b As Boolean
Dim prPlanNo, prMop As String
Dim prAmt As Long
Dim prDueDate As Date

Private Sub cmbReprint_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
database1 (cmbReprint.Text)
If b Then
cmbReprint.AddItem (cmbReprint.Text)
Else
MsgBox ("Invalid Register Number")
End If
cmbReprint.Text = ""
End If
End Sub

Private Sub cmdReprint_Click()
If cmbReprint.ListCount > 0 Then
Set c = New Connection
c.Provider = "Microsoft.Jet.OLEDB.4.0"
Set rs6 = New Recordset
rs6.LockType = adLockOptimistic
rs6.CursorLocation = adUseServer
rs6.CursorType = adOpenKeyset
For i = 0 To cmbReprint.ListCount - 1
reprint (cmbReprint.List(i))
Next
cmbReprint.Clear
End If
End Sub

Private Sub Combo1_DropDown()
Call addcombo
End Sub
Private Sub Command1_Click()
Dim mop As Integer
For j = 1 To Val(Text17)
Call database(Text1)
For i = 2 To rs3.Fields().Count - 1
If IsNull(rs3.Fields(i)) Or rs3.Fields(i) = "" Then
rs3.Fields(i) = Trim(str(Val(Text6) + Val(Text16)))
rs3.Fields(i + 1) = DTPicker1.Value
rs3.Update
mop = Switch(Text5 = "Mly", Val(Text8) + 1, Text5 = "Qly", Val(Text8) * 3 + 1, Text5 = "Hly", Val(Text8) * 6 + 1, Text5 = "Yly", Val(Text8) * 12 + 1)
Call senior(rs1.Fields(15), Val(rs1!Inst), mop)
'Text6.SetFocus
Exit For
End If
Next i
'for css no.
If Val(Text17) > 1 Then Text8 = Val(Text8) + 1
Text14 = Val(Text14) + Switch(Val(mop) <= 12, (Val(Text6) - (Val(Text6) * 20) / 100), Val(mop) > 12, (Val(Text6) - (Val(Text6) * 5) / 100)) + Val(Text16)
Label21.Caption = str(Val(Label21.Caption) + Switch(Val(mop) <= 12, (Val(Text6) - (Val(Text6) * 20) / 100), Val(mop) > 12, (Val(Text6) - (Val(Text6) * 5) / 100)) + Val(Text16))
'for css number
Text15 = forcssno
'for fine updation
'If Text16 <> "" Then
'rs4.Fields(0) = f - Val(Text16)
'rs4.Update
'Else
'If Val(Text13) > 0 Then
'rs4.Fields(0) = f
'rs4.Update
'End If
'End If
Text16.Enabled = False
'save no. for printer
RichTextBox1.LoadFile (App.Path & "\print.txt")
RichTextBox1.Text = RichTextBox1.Text + (" " & Val(Text15) & "|" & Label25 & "-" & Text1)
RichTextBox1.saveFile (App.Path & "\print.txt")
RichTextBox1.LoadFile (App.Path & "\collection.txt")
RichTextBox1.Text = Val(RichTextBox1.Text) + Switch(Val(mop) <= 12, (Val(Text6) - (Val(Text6) * 20) / 100), Val(mop) > 12, (Val(Text6) - (Val(Text6) * 5) / 100)) + Val(Text16)
RichTextBox1.saveFile (App.Path & "\collection.txt")
Text16 = ""
'Call printing
Next j
MsgBox "Record is Updated"
Call clearing
Text1.SetFocus
End Sub
Private Sub Command2_Click()
Text14 = ""
End Sub
Private Sub Command3_Click()
n = -0.5
nc = 0
For i = 0 To Combo1.ListCount - 1
'If i + 1 Mod 3 = 0 Then n = -0.5
Combo1.Text = Combo1.List(0)
Call printing
Next i
End Sub

Private Sub Command4_Click()
Dim mop As Integer
Dim str As String
If checking(Text1) Then
Command4.Enabled = True
Text6.SetFocus
Call database(Text1)
For i = 2 To rs3.Fields().Count - 1
If IsNull(rs3.Fields(i)) Or rs3.Fields(i) = "" Then
rs3.Fields(i - 1) = Null
rs3.Fields(i - 2) = Null
rs3.Update
mop = Switch(Text5 = "Mly", Val(Text8), Text5 = "Qly", Val(Text8) * 3, Text5 = "Hly", Val(Text8) * 6, Text5 = "Yly", Val(Text8) * 12)
Call senior(rs1.Fields(15), -Val(Text6), mop)
MsgBox "Record is Deleted"
Exit For
End If
Next i
'for css no.
Text14 = Val(Text14) - (Switch(Val(mop) <= 12, (Val(Text6) - (Val(Text6) * 20) / 100), Val(mop) > 12, (Val(Text6) - (Val(Text6) * 5) / 100)) + Val(Text13))
Label21.Caption = Val(Label21.Caption) - (Switch(Val(mop) <= 12, (Val(Text6) - (Val(Text6) * 20) / 100), Val(mop) > 12, (Val(Text6) - (Val(Text6) * 5) / 100)) + Val(Text13))
'for css number
Text15 = revforcssno
'for fine updation
Text16.Enabled = False
'save no. for printer
Call revdelprtno
Text16 = ""
Call clearing
Text1.SetFocus
Text6.SetFocus
Else
MsgBox "Invalid Delete"
Command4.Enabled = False
End If
End Sub

Private Sub Command5_Click()
RichTextBox3.Text = ""
suma = 0
sumc = 0
Call connect
End Sub


Private Sub Command6_Click()
'RichTextBox2.LoadFile (App.Path & "\print.txt")
'RichTextBox2.Text = RichTextBox2.Text + " " + Label25
'RichTextBox2.Text = RichTextBox2.Text + " " + Text18
'RichTextBox2.SaveFile (App.Path & "\print.txt")
'Command6.Enabled = False
Label25 = Val(Label25) + 1
Text1.SetFocus
End Sub

Private Sub Command7_Click()
Call monthlyreport
End Sub

Private Sub DTPicker1_LostFocus()
If Text1 <> "" Then
Call tenmonth
Text13 = fine(Text1, DTPicker1.Value)
If Text13 > 0 Then Text16.Enabled = True
End If
End Sub

Private Sub Form_Load()
Command1.Enabled = False
Command4.Enabled = False
Label17.Caption = Format(Now, "dd/mm/yyyy")
RichTextBox1.LoadFile (App.Path & "\css.txt")
cs = RichTextBox1.Text
If Mid(cs, 1, 10) <> Format(Now, "dd/mm/yyyy") Then
RichTextBox1.Text = 0
RichTextBox1.saveFile (App.Path & "\collection.txt")
RichTextBox1.Text = Format(Now, "dd/mm/yyyy") & "-0"
RichTextBox1.saveFile (App.Path & "\css.txt")
Text14 = 0
Text15 = 0
End If
Text15 = Mid(RichTextBox1.Text, InStr(RichTextBox1.Text, "-") + 1, Len(RichTextBox1.Text))
RichTextBox1.LoadFile (App.Path & "\collection.txt")
Label21.Caption = RichTextBox1.Text
DTPicker1.Value = Now
DTPicker2.Value = Now
'cssno for unprinted customer
If Val(Text15) = 0 Then Call autocssno
End Sub

Private Sub Label22_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Picture3.Visible = True
End Sub
Private Sub Label23_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Picture3.Visible = False
End Sub

Private Sub Label25_DblClick()
If Val(Label25) - 1 > 0 Then Label25 = Val(Label25) - 1
End Sub

Private Sub Text1_LostFocus()
Dim bo As Boolean
DTPicker1.Value = Now
If Text1.Text <> "" Then
Call addcombo
bo = False
For i = 0 To Combo1.ListCount
If Text1.Text = Combo1.List(i) Then bo = True
Next i
a = 6
If bo Then
a = MsgBox("Already Exist Do You Want to Continue?", vbYesNo)
End If
If vbYes = a Then
Call database1(Text1)
If b Then
If currentdue(Text1) Then
If rs1.Fields(0) = Text1 Then
Text12 = rs1!DistributorCode
Text2 = rs1!Name
Text3 = rs1!planNo
Text4 = rs1!Term
Text5 = rs1!mop
dues = rs1!months / rs1!DueMonths
Text6 = Switch(dues > CInt(dues) And (currentdue(Text1) + 1) = (CInt(dues) + 1), (Val(rs1!Inst) / 2), 1, rs1!Inst)
Text7 = Switch(dues > CInt(dues), CInt(dues) + 1, 1, dues) 'Switch(rs1!planNo = "PlanA", 30, rs1!planNo = "PlanB" And rs1!Term = 2, 2, rs1!planNo = "PlanB" And rs1!Term = 4, 4, rs1!planNo = "PlanB" And rs1!Term = 6, 6, rs1!planNo = "PlanC", 5, rs1!planNo = "PlanD", 5)
Text8 = currentdue(Text1)
Text9 = currentAcc(Text1)
Text10 = rs1!Amt
Text11 = Switch(Year(lastpay(Text1)) < 2005, " ", Year(lastpay(Text1)), Format(lastpay(Text1), "mm/dd/yyyy"))
Text13 = fine(Text1, DTPicker1.Value)
If Val(Text13) > 0 Then Text16.Enabled = True
Else
MsgBox "Record is not here"
End If
Text6.SetFocus
Command1.Enabled = True
Command4.Enabled = True
Call tenmonth
If Text4 = "PlanB" Or Text4 = "PlanD" Then
Command1.Enabled = False
Command4.Enabled = False
End If
Else
MsgBox "Your Policy Already Finished..."
End If
Else
MsgBox "Invalid Reg. No."
Text1 = ""
Call clearing
Text1.SetFocus
End If
Else
Call clearing
End If
End If
End Sub
Private Sub database(s As String)
Set c = New Connection
c.Provider = "Microsoft.Jet.OLEDB.4.0"
'If rs1!planNo = "PlanA" Or rs1!planNo = "PlanC" Then
c.Open App.Path & "\" & rs1!DatabaseName & ".mdb"
Set rs3 = New Recordset
rs3.CursorLocation = adUseServer
rs3.CursorType = adOpenKeyset
rs3.LockType = adLockOptimistic
rs3.Open "select * from " & rs1!planNo & rs1!mop & " where JVM='" & s & "'", c
'Else
'c.Open App.Path & "\" & rs1!PlanNo & rs1!mop & ".mdb"
'Set rs3 = New Recordset
'rs3.CursorLocation = adUseServer
'rs3.CursorType = adOpenKeyset
'rs3.LockType = adLockOptimistic
'rs3.Open "select * from " & rs1!PlanNo & rs1!Term & " where JVM='" & s & "'", c
'End If
End Sub
Private Sub database1(s As String)
Set c = New Connection
c.Provider = "Microsoft.Jet.OLEDB.4.0"
c.Open App.Path & "\jeevan.mdb"
Set rs1 = New Recordset
rs1.CursorLocation = adUseServer
rs1.CursorType = adOpenKeyset
rs1.LockType = adLockOptimistic
rs1.Open "SELECT C.*, T.DatabaseName, T.Months, T.ShortDesc, P.DueMonths FROM (Customer C INNER JOIN TableDetails T ON C.PlanNo = T.TableName) INNER JOIN PlanDetails P ON C.Mop = P.PlanName WHERE C.JVM='" & s & "' AND T.Installment = 1", c
If rs1.RecordCount = 0 Or IsNull(rs1!branch) Then
b = False
Else
b = True
End If
End Sub
Private Function currentdue(s As String) As Integer
Call database(s)
For i = 2 To rs3.Fields().Count - 1
If IsNull(rs3.Fields(i)) Or rs3.Fields(i) = "" Then
currentdue = (i / 2) - 1
Exit For
ElseIf i = rs3.Fields.Count - 1 Then
currentdue = (i / 2) - 1
End If
Next i
End Function
Private Function currentAcc(s As String) As Double
Dim l As Double
Call database(s)
For i = 2 To rs3.Fields().Count - 1 Step 2
If Not IsNull(rs3.Fields(i)) And rs3.Fields(i) <> "" Then l = l + rs3.Fields(i)
If IsNull(rs3.Fields(i)) Or rs3.Fields(i) = "" Then
currentAcc = l
Exit For
End If
Next i
End Function

Private Function lastpay(s As String) As Date
Call database(s)
For i = 2 To rs3.Fields().Count - 1
If IsNull(rs3.Fields(i)) Or rs3.Fields(i) = "" Then
If i - 1 <> 1 Then lastpay = rs3.Fields(i - 1)
Exit For
ElseIf rs3.Fields.Count - 1 = i Then
lastpay = rs3.Fields(i)
End If
Next i
End Function
Private Function fine(s As String, s1 As Date) As Long
Dim d1 As String
Dim m, f1 As Integer
Dim cur, actualDue As Integer
Dim d2, d3 As String
Dim fineAmt As Long
'To find number of dues paid
cur = currentdue(s)
actualDue = findActualDue(s)
fineAmt = calculateTotalFine(s, actualDue)
fine = fineAmt

'To find the current due date of policy
'd2 = Switch(Year(dueDate()) < 2005, " ", Year(dueDate()), dueDate())
'Extract the month current due date
'm = (Val(months(d2))) Mod 12
'm = Switch(m = 0, 12, 1, m)

'To find correct date based on the month
'day1 = Switch(Val(days(d2)) > 28 And m = 2, Val(days(d2)) - (Val(days(d2)) - 28), Val(days(d2)) > 30 And (m = 4 Or m = 6 Or m = 9 Or m = 11), Val(days(d2)) - 1, 1, days(d2))

'To alter the current due date
'd1 = day1 & "/" & Switch(m < 10, "0" & m, 1, m) & "/" & (Year(d2) + Switch((Val(months(d2))) > 12, 1, 1, 0))
'To change the renewal date
'd3 = datechange(str(s1))
'm1 = DateDiff("m", months(d2) & "/" & Year(d2), months(d3) & "/" & Year(d3))
'm1 = Switch(m1 < 0, 0, 1, m1)
'Number of days between current due date and renewal date
'da1 = dateDiff("d", datechange(d1), datechange(d3))
'f1 = Switch(da1 <= 15, 0, da1 > 15, (Text6 * 5) / 100)

'Set d = New Connection
'd.Provider = "Microsoft.Jet.OLEDB.4.0"
'd.Open App.Path & "\jeevan.mdb"
'Set rs4 = New RecordSet
'rs4.CursorLocation = adUseServer
'rs4.CursorType = adOpenKeyset
'rs4.LockType = adLockOptimistic
'rs4.Open "select Fine from Fine where JVM='" & s & "'", d
'f = Switch(da1 <= 15, 0, da1 > 15 And da1 <= 30, (Text6 * 5) / 100, da1 > 30, Round((da1 / 30)) * ((Text6 * 5) / 100))
'If Not rs4.EOF Then f = f + Switch(IsNull(rs4.Fields(0)), 0, 1, rs4.Fields(0))
'fine = f
End Function

Private Function calculateTotalFine(ByVal policyNo As String, ByVal actualDue As Integer) As Long
Dim conn As Connection
Dim recSet As Recordset
Dim mop, planNo As String
Dim payableDate, payingDate, dateComm As Date
Dim isForEnded As Boolean
Dim fineAmt, dueAmt, paidAmt As Long
fineAmt = 0
Set conn = New Connection
conn.Provider = "Microsoft.Jet.OLEDB.4.0"
conn.Open App.Path & "\Jeevan.mdb"
Set recSet = New Recordset
recSet.CursorLocation = adUseServer
recSet.CursorType = adOpenKeyset
recSet.LockType = adLockOptimistic
recSet.Open "Select C.*, T.DatabaseName, T.Months From Customer C INNER JOIN TableDetails T ON C.PlanNo = T.TableName Where JVM='" & policyNo & "'", conn
If recSet.RecordCount > 0 Then
mop = recSet.Fields("MoP").Value
planNo = recSet.Fields("PlanNo").Value
dueAmt = recSet.Fields("Inst").Value
DatabaseName = recSet.Fields("DatabaseName").Value
recSet.Close
conn.Close
conn.Open App.Path & "\" & DatabaseName & ".mdb"
recSet.Open "Select * From " & planNo & mop & " Where JVM = '" & policyNo & "'", conn
If recSet.RecordCount > 0 Then
isForEnded = False
For i = 1 To actualDue
If Not isForEnded Then
dateComm = recSet.Fields(3)
For j = 5 To recSet.Fields.Count Step 2
If IsNull(recSet.Fields(j)) Or recSet.Fields(j) = "" Then
isForEnded = True
Exit For
Else
paidAmt = recSet.Fields(j - 1)
payableDate = DateAdd("m", i * Int(Switch(mop = "Mly", 1, mop = "Qly", 3, mop = "Hly", 6, mop = "Yly", 12)), dateComm)
payingDate = recSet.Fields(j)
fineAmt = fineAmt + (monthlyFine(payableDate, payingDate, dueAmt) + dueAmt - paidAmt)
i = i + 1
End If
Next j
End If
payableDate = DateAdd("m", i * Int(Switch(mop = "Mly", 1, mop = "Qly", 3, mop = "Hly", 6, mop = "Yly", 12)), dateComm)
payingDate = DTPicker1.Value
fineAmt = fineAmt + monthlyFine(payableDate, payingDate, dueAmt)
Next i
End If
End If
calculateTotalFine = fineAmt
End Function

Private Function monthlyFine(ByVal payableDate As Date, ByVal payingDate As Date, ByVal dueAmt As Long) As Long
Dim dateDifference As Integer
dateDifference = DateDiff("d", payableDate, payingDate)
monthlyFine = Switch(dateDifference > 15 And dateDifference < 31, (dueAmt * 3) / 100, dateDifference > 30, (Int(dateDifference / 30) + 1) * ((dueAmt * 3) / 100), 1, 0)
End Function
Private Function findActualDue(ByVal policyNo As String) As Integer
Dim conn As Connection
Dim recSet As Recordset
Dim longDue As Long
Dim mop As String
Dim monthDiff As Integer
Set conn = New Connection
conn.Provider = "Microsoft.Jet.OLEDB.4.0"
conn.Open App.Path & "\jeevan.mdb"
Set recSet = New Recordset
recSet.CursorLocation = adUseServer
recSet.CursorType = adOpenKeyset
recSet.LockType = adLockOptimistic
recSet.Open "Select * From Customer Where JVM='" & policyNo & "'", conn
If recSet.RecordCount > 0 Then
mop = recSet.Fields("MOP").Value
monthDiff = DateDiff("m", recSet.Fields("DateCom"), DTPicker1.Value)
longDue = Switch(mop = "Mly", monthDiff, mop = "Qly", monthDiff / 3, mop = "Hly", monthDiff / 6, mop = "Yly", monthDiff / 12)
If (longDue > Int(longDue)) Then
findActualDue = Int(longDue) + 1
Else
findActualDue = Int(longDue)
End If
End If
recSet.Close
conn.Close
End Function

Private Sub printing()
Dim j, X As Integer
'Printer.PaperSize = 256
'Printer.Height = 2
'Printer.Width = 5
Dim curd As Integer
'for Agent for
Dim cg As Integer
database1 (Combo1.Text)
If Combo1.ListCount > 0 And Combo1.Text <> "" Then
'Printer.PaperSize = vbPRPSEnv10
Printer.ScaleMode = 7

Printer.FontName = "Copperplate Gothic Light"
Printer.FontBold = False
Printer.FontSize = 10
'css name

Printer.Print
Printer.Print
Printer.Print
Printer.Print

Printer.CurrentX = 13#
Printer.CurrentY = 1.35 + n
Printer.Print "Karaikudi"
'css code
Printer.CurrentX = 13
Printer.CurrentY = 1.85 + n
Printer.Print "04565"
' css no
Printer.CurrentX = 13
Printer.CurrentY = 2.35 + n
Printer.Print cssno(Combo1.Text)
'instalment no.
Printer.CurrentX = 13
Printer.CurrentY = 3.2 + n
Printer.Print currentdue(Combo1.Text) - comcount(Combo1.Text)
' for receipt number
RichTextBox1.LoadFile (App.Path & "/rgnno.txt")
Printer.CurrentX = 17.5
Printer.CurrentY = 1.35 + n
Printer.Print RichTextBox1.Text
RichTextBox1.Text = Val(RichTextBox1.Text) + 1
RichTextBox1.saveFile (App.Path & "/rgnno.txt")
'now date
Printer.CurrentX = 17.5
Printer.CurrentY = 1.85 + n
Call database(Combo1.Text)
For i = 0 To rs3.Fields().Count - 1
If IsNull(rs3.Fields(i)) Then
X = i - 1
Exit For
ElseIf i = rs3.Fields.Count - 1 Then
X = i
Exit For
End If
Next i
Printer.Print datechange(rs3.Fields(X))
'due date
Printer.CurrentX = 17.5
Printer.CurrentY = 2.3 + n
'j = currentdue(Combo1.Text)
'j = Switch(rs1!mop = "Mly", j, rs1!mop = "Qly", j * 3, rs1!mop = "Hly", j * 6, rs1!mop = "Yly", j * 12)
'If Month(Format(rs1!datecom, "mm/yyyy")) + j >= 12 Then
'j = (Month(Format(rs1!datecom, "mm/yyyy")) + j) Mod 12
'k = Year(rs1!datecom) + 1
'Else
'j = Switch((Month(Format(rs1!datecom, "mm/yyyy")) + j) Mod 12 = 0, j, 1, (Month(Format(rs1!datecom, "mm/yyyy")) + j) Mod 12)
'End If
'Printer.Print Format(rs1!datecom, "dd"); "/"; j; "/"; k
'Else
'j = (Month(Format(rs1!datecom, "mm/yyyy")) + j) Mod 12
'End If
'Printer.Print Format(rs1!datecom, "dd"); "/"; j; "/"; k
'due date
'Printer.CurrentX = 17.2
'Printer.CurrentY = 2.85
j = currentdue(Combo1.Text) - comcount(Combo1.Text)
j = (j - 1) * rs1!DueMonths 'Switch(rs1!mop = "Mly", j - 1, rs1!mop = "Qly", (j - 1) * 3, rs1!mop = "Hly", (j - 1) * 6, rs1!mop = "Yly", (j - 1) * 12)
'If Month(Format(rs1!datecom, "mm/yyyy")) + j > 12 Then
k = Year(rs1!datecom) + Int(((Val(months(datechange(rs1!datecom))) + j) - 1) / 12)
j = (Val(months(datechange(rs1!datecom))) + j) Mod 12
j = Switch(j = 0, 12, 1, j)
d2 = datechange(rs1!datecom)
day1 = Switch(Val(days(d2)) > 28 And j = 2, Val(days(d2)) - (Val(days(d2)) - 28), Val(days(d2)) > 30 And (j = 4 Or j = 6 Or j = 9 Or j = 11), Val(days(d2)) - 1, 1, days(d2))
Printer.Print day1; "/"; Switch(j < 10, "0" & j, 1, j); "/"; k
'next due
Printer.CurrentX = 17.5
Printer.CurrentY = 2.75 + n
j = currentdue(Combo1.Text) - comcount(Combo1.Text)
j = j * rs1!DueMonths 'Switch(rs1!mop = "Mly", j, rs1!mop = "Qly", (j) * 3, rs1!mop = "Hly", (j) * 6, rs1!mop = "Yly", (j) * 12)
'If Month(Format(rs1!datecom, "mm/yyyy")) + j > 12 Then
k = Val(Year(rs1!datecom)) + Int(((Val(months(datechange(rs1!datecom))) + j) - 1) / 12)
j = (Val(months(datechange(rs1!datecom))) + j) Mod 12
j = Switch(j = 0, 12, 1, j)
d2 = datechange(rs1!datecom)
day1 = Switch(Val(days(d2)) > 28 And j = 2, Val(days(d2)) - (Val(days(d2)) - 28), Val(days(d2)) > 30 And (j = 4 Or j = 6 Or j = 9 Or j = 11), Val(days(d2)) - 1, 1, days(d2))
Printer.Print day1; "/"; Switch(j < 10, "0" & j, 1, j); "/"; k
'end due
Printer.CurrentX = 17.5
Printer.CurrentY = 3.2 + n
If (rs1!months Mod 12) <> 0 Then
j = rs1!months
k = Val(Year(rs1!datecom)) + Int(((Val(months(datechange(rs1!datecom))) + j) - 1) / 12)
j = (Val(months(datechange(rs1!datecom))) + j) Mod 12
j = Switch(j = 0, 12, 1, j)
Else
j = Format(rs1!datecom, "mm")
k = Year(rs1!datecom) + rs1!Term
End If
d2 = datechange(rs1!datecom)
day1 = Switch(Val(days(d2)) > 28 And j = 2, Val(days(d2)) - (Val(days(d2)) - 28), Val(days(d2)) > 30 And (j = 4 Or j = 6 Or j = 9 Or j = 11), Val(days(d2)) - 1, 1, days(d2))
Printer.Print day1; "/"; Switch(j < 10, "0" & j, 1, j); "/"; k
'jvm
Printer.CurrentX = 2.5
Printer.CurrentY = 4.9 + n
Call database1(Combo1.Text)
Printer.Print rs1!branch; rs1.Fields(0)
'trem and plan
Printer.CurrentX = 2.5
Printer.CurrentY = 5.3 + n
Printer.Print "Plan-" & rs1!ShortDesc; " & "; Switch(rs1!Term = "2.5", "2Y 6M", 1, rs1!Term & "Yrs.")
'distributor codeno
Printer.CurrentX = 2.5
Printer.CurrentY = 5.7 + n
Printer.Print rs1!DistributorCode
'amount
Printer.CurrentX = 3.2
Printer.CurrentY = 6.1 + n
Printer.Print rs1!Inst
'expect amount
Printer.CurrentX = 4.8
Printer.CurrentY = 6.5 + n
Set d = New Connection
d.Provider = "Microsoft.Jet.OLEDB.4.0"
d.Open App.Path & "\" & rs1!DatabaseName & ".mdb"
Set rs2 = New Recordset
rs2.CursorLocation = adUseServer
rs2.CursorType = adOpenKeyset
rs2.LockType = adLockOptimistic
rs2.Open "select ExpConsi from " & rs1!planNo & " where Consi='" & rs1!Amt & "'", d
Printer.Print rs2!ExpConsi
'instal
Printer.CurrentX = 5.5
Printer.CurrentY = 6.9 + n
Printer.Print rs1!Inst
'fine
Printer.CurrentX = 2.5
Printer.CurrentY = 7.3 + n
'Set d = New Connection
'd.Provider = "Microsoft.Jet.OLEDB.4.0"
'd.Open App.Path & "\jeevan.mdb"
'Set rs4 = New Recordset
'rs4.CursorLocation = adUseServer
'rs4.CursorType = adOpenKeyset
'rs4.LockType = adLockOptimistic
'rs4.Open "select Fine from Fine where JVM='" & Combo1.Text & "'", d
'Printer.Print Switch(IsNull(rs4.Fields(0)), 0, 1, rs4.Fields(0))
Printer.Print fine(rs1.Fields(0), DateTime.Now)
Printer.CurrentX = 9#
Printer.CurrentY = 4.8 + n
Printer.Print datechange(rs1!datecom)
Printer.CurrentX = 9#
Printer.CurrentY = 5.3 + n
Printer.Print rs1!Amt
Printer.CurrentX = 9#
Printer.CurrentY = 5.7 + n
Printer.Print rs1!mop
'year
Printer.CurrentX = 9#
Printer.CurrentY = 6.1 + n
curd = currentdue(Combo1.Text) - comcount(Combo1.Text)
Printer.Print Switch((curd) <= 12, "1st", (curd) > 12 And (curd) <= 24, "2nd", (curd) > 24 And (curd) <= 36, "3rd", (curd) > 36 And (curd) <= 48, "4th", (curd) > 48, "5th")
Printer.CurrentX = 13
Printer.CurrentY = 5.2 + n
Printer.Print rs1!Name
Printer.CurrentX = 13
Printer.Print rs1!RName
Printer.CurrentX = 13
i = SplitWords(rs1.Fields(14))
For j = 0 To i
Printer.CurrentX = 13
Printer.Print s(j)
Next j
'convert(Val(rs1!Inst) + Val(fine(Combo1.Text))); "Only"
'Printer.Print convert(rs1!Inst); "Only"
'Printer.Print convert(rs2!ExpConsi); "Only"
Printer.CurrentX = 1
Printer.CurrentY = 8.5 + n
Printer.Print convert(rs1!Inst); "Only"
Call deleteprtno
Call addcombo
'Printer.NewPage
nc = nc + 1
If nc Mod 3 = 0 Or Combo1.ListCount = 0 Then
Printer.EndDoc
1 n = -0.5
Else
n = Switch(nc Mod 3 = 1, 9.6, nc Mod 3 = 2, 19.7)
End If
Else
MsgBox "Select the Number First"
End If
End Sub

Private Function SplitWords(X As String) As Integer
j = 0
s(0) = ""
For i = 1 To Len(X)
If AscW(Mid(X, i, 1)) <> 13 Then
s(j) = s(j) + Mid(X, i, 1)
Else
j = j + 1
s(j) = ""
i = i + 1
End If
Next i
SplitWords = j
End Function
Private Sub deleteprtno()
Dim l, s As Integer
RichTextBox1.LoadFile (App.Path & "/print.txt")
s = InStr(RichTextBox1.Text, cssno(Combo1.Text) & "|" & Label25 & "-" & Combo1.Text) - 2
l = Len(cssno(Combo1.Text) & "|" & Label25 & "-" & Combo1.Text) + 1
RichTextBox1.SelStart = s
RichTextBox1.SelLength = l
RichTextBox1.SelText = ""
RichTextBox1.saveFile (App.Path & "/print.txt")
End Sub
Private Sub addcombo()
Dim t, s As String
Combo1.Clear
s = ""
RichTextBox1.LoadFile (App.Path & "\print.txt")
s = Trim(RichTextBox1.Text)
For i = 1 To Len(s) + 1
If Mid(s, i, 1) <> " " And i <> Len(s) + 1 Then
t = t + Mid(s, i, 1)
Else
If t <> "" Then
If Mid(t, (InStr(1, t, "|") + 1), (InStr(1, t, "-") - (InStr(1, t, "|") + 1))) = Label25 Then Combo1.AddItem Mid(t, InStr(1, t, "-") + 1, Len(t))
End If
t = ""
End If
Next i
End Sub
Private Function forcssno() As Integer
Dim cs As String
Dim cssno As Integer
RichTextBox1.LoadFile (App.Path & "\css.txt")
cs = RichTextBox1.Text
cssno = Val(Mid(cs, InStr(cs, "-") + 1, Len(cs))) + 1
RichTextBox1.Text = Format(Now, "dd/mm/yyyy") & "-" & cssno
RichTextBox1.saveFile (App.Path & "\css.txt")
forcssno = cssno
End Function
Private Sub revdelprtno()
Dim l, s As Integer
RichTextBox1.LoadFile (App.Path & "/print.txt")
s = InStr(RichTextBox1.Text, cssno(Text1.Text) & "|" & Label25 & "-" & Text1.Text) - 1
l = Len(cssno(Text1.Text) & "|" & Label25 & "-" & Text1.Text) + 1
RichTextBox1.SelStart = s
RichTextBox1.SelLength = l
RichTextBox1.SelText = ""
RichTextBox1.saveFile (App.Path & "/print.txt")
End Sub

Private Function revforcssno() As Integer
Dim cs As String
Dim cssno As Integer
RichTextBox1.LoadFile (App.Path & "\css.txt")
cs = RichTextBox1.Text
cssno = Val(Mid(cs, InStr(cs, "-") + 1, Len(cs))) - 1
RichTextBox1.Text = Format(Now, "dd/mm/yyyy") & "-" & cssno
RichTextBox1.saveFile (App.Path & "\css.txt")
revforcssno = cssno
End Function
Private Function checking(s As String) As Boolean
Dim b As Integer
RichTextBox1.LoadFile (App.Path & "\print.txt")
X = RichTextBox1.Find(s)
If X >= 0 Then
checking = True
Else
checking = False
End If
End Function
Private Function comcount(s As String) As Integer
Dim k As Integer
For i = 0 To Combo1.ListCount
If s = Combo1.List(i) Then
k = k + 1
End If
Next i
comcount = k - 1
End Function

Private Sub tenmonth()
Dim t, l As Integer
Dim d As Date
d = Text11.Text
t = DTPicker1.Value - d
If t > 365 Then
l = MsgBox("The Renewal date is expires " + vbNewLine + "The month is above Ten month" + vbNewLine + "Do you want to save it ?", vbOKCancel)
If l = vbCancel Then Command1.Enabled = False
End If
End Sub

Private Sub clearing()
Text1 = ""
Text2 = ""
Text3 = ""
Text4 = ""
Text5 = ""
Text6 = ""
Text7 = ""
Text8 = ""
Text9 = ""
Text10 = ""
Text11 = ""
Text12 = ""
Text13 = ""
Text16 = ""
Text17 = 1
DTPicker1.Value = Now
Command1.Enabled = False
End Sub

Private Function dueDate() As String
Dim j, k As Integer
j = currentdue(Text1) - comcount(Text1)
j = Switch(rs1!mop = "Mly", j - 1, rs1!mop = "Qly", (j - 1) * 3, rs1!mop = "Hly", (j - 1) * 6, rs1!mop = "Yly", (j - 1) * 12)
k = Year(rs1!datecom) + Int(((Val(months(datechange(rs1!datecom))) + j) - 1) / 12)
j = (Val(months(datechange(rs1!datecom))) + j) Mod 12
j = Switch(j = 0, 12, 1, j)
d2 = datechange(rs1!datecom)
day1 = Switch(Val(days(d2)) > 28 And j = 2, Val(days(d2)) - (Val(days(d2)) - 28), Val(days(d2)) > 30 And (j = 4 Or j = 6 Or j = 9 Or j = 11), Val(days(d2)) - 1, 1, days(d2))

dueDate = day1 & "/" & Switch(j < 10, "0" & j, 1, j) & "/" & k
End Function

Private Sub Text17_LostFocus()
If (Val(Text8) + Val(Text17)) > 30 And Text3 = "PlanA" Then
MsgBox "Paying Dues exceeding from 30 Months Pls Check it"
Text17 = 1
End If
If (Val(Text8) + Val(Text17)) > 60 And Text3 = "PlanC" Then
MsgBox "Paying Dues exceeding from 60 Months Pls Check it"
Text17 = 1
End If
End Sub

Private Sub Text18_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 And Text19 <> "" And Text20 <> "" Then
Set pc = New Connection
pc.Provider = "Microsoft.Jet.OLEDB.4.0"
pc.Open App.Path & "\Jeevan.mdb"
'for find record in customer
Set rs5 = New Recordset
rs5.CursorLocation = adUseServer
rs5.CursorType = adOpenKeyset
rs5.LockType = adLockOptimistic
rs5.Open "select * from customer where JVM='" & Text18.Text & "'", pc
If Not rs5.EOF Then
RichTextBox2.LoadFile (App.Path & "\print.txt")
'RichTextBox2.Text = RichTextBox2.Text + Label25 + " "
RichTextBox2.Text = RichTextBox2.Text + " " & Text19 & "|" & Text20 & "-" & Text18
RichTextBox2.saveFile (App.Path & "\print.txt")
Else
MsgBox "Invalid Policy Number"
End If
Text19 = ""
Text18 = ""
Text19.SetFocus
pc.Close
End If
End Sub

Private Sub connect()
Dim con As Connection
Dim cmd As Recordset
Dim aa(5), ac(5), fa(1000), t As String
Dim k, s, dis(1000), adis(1000), cdis(1000), comma(1000), commc(1000), repFineA, repFineC As Integer
'Array used to calculate total collection amount of first year and second year collection. Array(0) - I Year Collection, Array(1) 0 - II & More Year Collection
Dim aTotal(2), cTotal(2), aTotalF(2), cTotalF(2) As Double
aa(0) = "PlanAMly"
aa(1) = "PlanAQly"
aa(2) = "PlanAHly"
aa(3) = "PlanAYly"
ac(0) = "PlanCMly"
ac(1) = "PlanCQly"
ac(2) = "PlanCHly"
ac(3) = "PlanCYly"
Set con = New Connection
con.Provider = "Microsoft.Jet.OLEDB.4.0"
con.Open App.Path & "\Jeevan.mdb"
Set pa = New Connection
pa.Provider = "Microsoft.Jet.OLEDB.4.0"
pa.Open App.Path & "\PlanA.mdb"
Set pc = New Connection
pc.Provider = "Microsoft.Jet.OLEDB.4.0"
pc.Open App.Path & "\PlanC.mdb"
'for find date in plan a
For i = 0 To 3
Set rs5 = New Recordset
rs5.CursorLocation = adUseServer
rs5.CursorType = adOpenKeyset
rs5.LockType = adLockOptimistic
rs5.Open "select * from " & aa(i), pa
co = Switch(i = 0, 1, i = 1, 3, i = 2, 6, i = 3, 12)
While Not rs5.EOF
Set cmd = New Recordset
cmd.CursorLocation = adUseServer
cmd.CursorType = adOpenKeyset
cmd.LockType = adLockOptimistic
cmd.Open "Select Inst from customer where JVM='" & rs5!JVM & "'", con
For j = 3 To 59 / co
varper = Switch(((j / 2) * co <= 12), 20, 1, 5)
If IsNull(rs5.Fields(j + 2)) Or IsEmpty(rs5.Fields(j + 2)) Then Exit For
If Format(rs5.Fields(j + 2), "m/d/yyyy") = Format(DTPicker2.Value, "m/d/yyyy") Then
fa(k) = Val(rs5.Fields(0))
suma = suma + (Val(cmd!Inst) - (Val(cmd!Inst) * (varper / 100)))
comma(k) = (Val(cmd!Inst) * (varper / 100))
If (varper = 20) Then
aTotal(0) = aTotal(0) + (Val(cmd!Inst) - (Val(cmd!Inst) * (varper / 100)))
aTotalF(0) = aTotalF(0) + Val(cmd!Inst)
ElseIf (varper = 5) Then
aTotal(1) = aTotal(1) + (Val(cmd!Inst) - (Val(cmd!Inst) * (varper / 100)))
aTotalF(1) = aTotalF(1) + Val(cmd!Inst)
End If
'to check fine amount
If cmd!Inst <> rs5.Fields(j + 1) Then repFineA = repFineA + (Val(rs5.Fields(j + 1)) - Val(cmd!Inst))
k = k + 1
End If
Next j
rs5.MoveNext
Wend
Next i
' for find date in plan c
For i = 0 To 3
Set rs5 = New Recordset
rs5.CursorLocation = adUseServer
rs5.CursorType = adOpenKeyset
rs5.LockType = adLockOptimistic
rs5.Open "select * from " & ac(i), pc
co = Switch(i = 0, 1, i = 1, 3, i = 2, 6, i = 3, 12)
While Not rs5.EOF
Set cmd = New Recordset
cmd.CursorLocation = adUseServer
cmd.CursorType = adOpenKeyset
cmd.LockType = adLockOptimistic
cmd.Open "Select Inst from customer where JVM='" & rs5!JVM & "'", con
For j = 3 To 119 / co
varper = Switch(((j / 2) * co <= 12), 20, 1, 5)
'If IsNull(rs5.Fields(j + 2)) Or IsEmpty(rs5.Fields(j + 2)) Then Exit For
If Format(rs5.Fields(j + 2), "m/d/yyyy") = Format(DTPicker2.Value, "m/d/yyyy") Then
fa(k) = Val(rs5.Fields(0))
sumc = sumc + (Val(cmd!Inst) - (Val(cmd!Inst) * (varper / 100)))
commc(k) = (Val(cmd!Inst) * (varper / 100))
If (varper = 20) Then
cTotal(0) = cTotal(0) + (Val(cmd!Inst) - (Val(cmd!Inst) * (varper / 100)))
cTotalF(0) = cTotalF(0) + Val(cmd!Inst)
ElseIf (varper = 5) Then
cTotal(1) = cTotal(1) + (Val(cmd!Inst) - (Val(cmd!Inst) * (varper / 100)))
cTotalF(1) = cTotalF(1) + Val(cmd!Inst)
End If
'to check fine amount
If cmd!Inst <> rs5.Fields(j + 1) Then repFineC = repFineC + (Val(rs5.Fields(j + 1)) - Val(cmd!Inst))
k = k + 1
End If
Next j
rs5.MoveNext
Wend
Next i
Set pa = New Connection
pa.Provider = "Microsoft.Jet.OLEDB.4.0"
pa.Open App.Path & "\Jeevan.mdb"
For i = 0 To k - 1
Set rs6 = New Recordset
rs6.CursorLocation = adUseServer
rs6.CursorType = adOpenKeyset
rs6.LockType = adLockOptimistic
rs6.Open "select * from customer where JVM='" & fa(i) & "'", pa
'If rs6!PlanNo = "PlanA" Then
'Else
'sumc = sumc + Val(rs6!inst)
'End If
fd(i) = rs6!DistributorCode
Next i
For i = 0 To k - 1
For j = i + 1 To k - 1
If Val(fd(i)) > Val(fd(j)) Then
t = fd(i)
fd(i) = fd(j)
fd(j) = t
End If
Next j
Next i
s = 1
For i = 0 To k - 1
For j = i + 1 To k - 1
If fd(i) <> fd(j) Then
fd(s) = fd(j)
i = j
s = s + 1
End If
Next j
Next i
RichTextBox3.Text = "Code Nos.:"
For i = 0 To s - 1
RichTextBox3.Text = RichTextBox3.Text + "  " + fd(i)
Next i
RichTextBox3.Text = RichTextBox3.Text + vbNewLine & "Total Amount of Plan A : Rs. " & suma
RichTextBox3.Text = RichTextBox3.Text + vbNewLine & "Total Amount of Plan C : Rs. " & sumc
'RichTextBox3.Text = RichTextBox3.Text + vbNewLine + vbNewLine + vbNewLine & Space(5) & "Individual Amount for an Employee"
For i = 0 To k - 1
For j = 0 To s - 1
Set rs6 = New Recordset
rs6.CursorLocation = adUseServer
rs6.CursorType = adOpenKeyset
rs6.LockType = adLockOptimistic
rs6.Open "select * from customer where JVM='" & fa(i) & "' and DistributorCode='" & fd(j) & "'", pa
If Not rs6.EOF Then
If rs6!planNo = "PlanA" Then
adis(j) = adis(j) + Val(rs6!Inst) - comma(i)
dis(j) = dis(j) + Val(rs6!Inst) - comma(i)
Else
cdis(j) = cdis(j) + Val(rs6!Inst) - commc(i)
dis(j) = dis(j) + Val(rs6!Inst) - commc(i)
End If
End If
Next j
'RichTextBox3.Text = RichTextBox3.Text + vbNewLine + vbNewLine & fd(i) & " Rs. : " & dis(i)
Next i

Pag = 1
'Else
'c.Open App.Path & "\" & rs1!PlanNo & rs1!mop & ".mdb"
'Set rs3 = New Recordset
'rs3.CursorLocation = adUseServer
'rs3.CursorType = adOpenKeyset
'rs3.LockType = adLockOptimistic
'rs3.Open "select * from " & rs1!PlanNo & rs1!Term & " where JVM='" & s & "'", c
Printer.ScaleMode = 7

Printer.CurrentY = 2
Printer.CurrentX = 18
Printer.Print "Page " & Pag
Pag = Pag + 1

Printer.CurrentY = 2
Printer.CurrentX = 6
Printer.FontBold = True
Printer.FontSize = 14
'Printer.PaintPicture Image1, 5.3, 1.7, 0.9, 0.9
Printer.Print "Jeevan Vaisya Green AgroTech LLP"
Printer.FontBold = False
Printer.FontSize = 10
Printer.CurrentX = 8
Printer.Print "49,49/1, Matha Nilayam,"
Printer.CurrentX = 7
Printer.Print "LIC (Opposite), V.O.C.Road, Karaikudi"
Printer.CurrentX = 8
Printer.Print ""
Printer.Print
Printer.Print
Printer.CurrentX = 8
Printer.Print "Renewal Daily Report Form"
Printer.FontSize = 9
Printer.CurrentY = 5
Printer.CurrentX = 0.5
Printer.Print "Report Date: " & datechange(DTPicker2.Value)
Printer.CurrentY = 5
Printer.CurrentX = 15.5
Printer.Print "Date: " & datechange(Now) & " " & Format(Now, "hh:mm AM/PM")
Printer.Print "_______________________________________________________________________________________________________________________________________________________________________________________________________________"
'1
Printer.CurrentY = 6
Printer.CurrentX = 0.5
'2
X = Printer.CurrentX
Printer.Print "S.No."

Printer.CurrentY = 6
Printer.CurrentX = 1.5
'6
X = Printer.CurrentX
Printer.Print "Code No."

Printer.CurrentY = 6
Printer.CurrentX = 5.5
'9
Printer.Print "Name"

Printer.CurrentY = 6
Printer.CurrentX = 12.5
Printer.Print "Plan A"

Printer.CurrentY = 6
Printer.CurrentX = 16
Printer.Print "Plan C"
'12

Printer.CurrentY = 6
Printer.CurrentX = 18
Printer.Print "Total Collection"
'18
'Printer.CurrentY = 6
'Printer.CurrentX = 18
X = Printer.CurrentX
'Printer.Print "Signature"
'20
Printer.Print "_______________________________________________________________________________________________________________________________________________________________________________________________________________"
Printer.Print
If suma <> 0 Or sumc <> 0 Then
For i = 0 To s - 1
Y = Printer.CurrentY
Set rs6 = New Recordset
rs6.CursorLocation = adUseServer
rs6.CursorType = adOpenKeyset
rs6.LockType = adLockOptimistic
rs6.Open "select * from agentinfo where codeno='" & fd(i) & "'", pa
Printer.CurrentY = Y
Printer.CurrentX = 0.5
Printer.Print (i + 1)
Printer.CurrentY = Y
Printer.CurrentX = 1.5
Printer.Print fd(i)
Printer.CurrentY = Y
Printer.CurrentX = 4.5
Printer.Print rs6!Name
'planA
Printer.CurrentY = Y
Printer.CurrentX = 12.5
Printer.Print FormatCurrency(Switch(IsEmpty(adis(i)), 0, 1, adis(i)), 2)
'planc
Printer.CurrentY = Y
Printer.CurrentX = 16
Printer.Print FormatCurrency(Switch(IsEmpty(cdis(i)), 0, 1, cdis(i)), 2)
'total
Printer.CurrentY = Y
Printer.CurrentX = 18
Printer.Print FormatCurrency(dis(i), 2)
Printer.Print


If i = s - 1 Then
Printer.Print
Printer.CurrentX = 5
Printer.Print "-------------------------------------------------- * End * ------------------------------------------------------- "
End If

'If ((i + 1) Mod 22) = 0 Or i = s - 1 Then
'Printer.CurrentY = 24
'Printer.CurrentX = 18
'Printer.Print pag
'pag = pag + 1
'End If

If ((i + 1) Mod 20) = 0 Then
Printer.NewPage
Printer.ScaleMode = 7

Printer.CurrentY = 2
Printer.CurrentX = 18
Printer.Print "Page " & Pag
Pag = Pag + 1

Printer.CurrentY = 2
Printer.CurrentX = 6
Printer.FontBold = True
Printer.FontSize = 14
Printer.Print "Jeevan Vaisya Green AgroTech LLP"
Printer.FontBold = False
Printer.FontSize = 10
Printer.CurrentX = 8
Printer.Print "49,49/1, Matha Nilayam,"
Printer.CurrentX = 7
Printer.Print "LIC (Opposite), V.O.C.Road, Karaikudi"
Printer.CurrentX = 8
Printer.Print ""
Printer.Print
Printer.Print
Printer.CurrentX = 8
Printer.Print "Renewal Daily Report Form"
Printer.FontSize = 9
Printer.CurrentY = 5
Printer.CurrentX = 0.5
Printer.Print "Report Date: " & datechange(DTPicker2.Value)
Printer.CurrentY = 5
Printer.CurrentX = 15.5
Printer.Print "Date: " & datechange(Now) & " " & Format(Now, "hh:mm AM/PM")
Printer.Print "_______________________________________________________________________________________________________________________________________________________________________________________________________________"
'1
Printer.CurrentY = 6
Printer.CurrentX = 0.5
'2
X = Printer.CurrentX
Printer.Print "S.No."

Printer.CurrentY = 6
Printer.CurrentX = 1.5
'6
X = Printer.CurrentX
Printer.Print "Code No."

Printer.CurrentY = 6
Printer.CurrentX = 5.5
'9
Printer.Print "Name"

Printer.CurrentY = 6
Printer.CurrentX = 12.5
Printer.Print "Plan A"

Printer.CurrentY = 6
Printer.CurrentX = 16
Printer.Print "Plan C"
'12

Printer.CurrentY = 6
Printer.CurrentX = 18
Printer.Print "Total Collection"
'18
'Printer.CurrentY = 6
'Printer.CurrentX = 18
X = Printer.CurrentX
'Printer.Print "Signature"
'20
Printer.Print "_______________________________________________________________________________________________________________________________________________________________________________________________________________"
Printer.Print
End If
Next
Printer.CurrentY = 24
Printer.Print "_______________________________________________________________________________________________________________________________________________________________________________________________________________"
Printer.Print

Y = Printer.CurrentY
Printer.Print "Total Amount of Plan A : " & FormatCurrency(suma, 2)
Printer.CurrentX = 10
Printer.CurrentY = Y
Printer.Print "Total Collection Amount (First Year) : " & FormatCurrency((aTotal(0) + cTotal(0)), 2)
Printer.Print

Y = Printer.CurrentY
Printer.Print "Total Amount of Plan C : " & FormatCurrency(sumc, 2)
Printer.CurrentX = 10
Printer.CurrentY = Y
Printer.Print "Total Amount (Without Comm. I Year) : " & FormatCurrency((aTotalF(0) + cTotalF(0)), 2)
Printer.Print

Y = Printer.CurrentY
Printer.Print "Total Fine Amount : " & FormatCurrency((repFineA + repFineC), 2)
Printer.CurrentX = 10
Printer.CurrentY = Y
Printer.Print "Total Collection Amount (II Year & Above) : " & FormatCurrency((aTotal(1) + cTotal(1)), 2)
Printer.Print

Y = Printer.CurrentY
Printer.Print "Total Collection : " & FormatCurrency((suma + sumc + repFineA + repFineC), 2)
Printer.CurrentX = 10
Printer.CurrentY = Y
Printer.Print "Total Amount (Without Comm. II Year & Above) : " & FormatCurrency((aTotalF(1) + cTotalF(1)), 2)

Printer.Print "_______________________________________________________________________________________________________________________________________________________________________________________________________________"
End If
Printer.EndDoc
End Sub
Private Function cssno(ByVal a As String) As String
Dim s, t, re As String
s = ""
RichTextBox1.LoadFile (App.Path & "\print.txt")
s = RichTextBox1.Text
For i = 1 To Len(s) + 1
If Mid(s, i, 1) <> " " And i <> Len(s) + 1 Then
t = t + Mid(s, i, 1)
Else
If t <> "" Then
If Mid(t, (InStr(1, t, "|") + 1), (InStr(1, t, "-")) - (InStr(1, t, "|") + 1)) = Label25 And Mid(t, InStr(1, t, "-") + 1, Len(t)) = a Then
re = Mid(t, 1, (InStr(1, t, "|") - 1))
Exit For
End If
End If
t = ""
End If
Next i
cssno = re
End Function
Private Function autocssno() As String
Dim s, t, re As String
s = ""
RichTextBox1.LoadFile (App.Path & "\print.txt")
s = RichTextBox1.Text
If s <> "" Then
For i = 1 To Len(s) + 1
RichTextBox1.LoadFile (App.Path & "\print.txt")
s = RichTextBox1.Text
If Len(s) > 5 Then
If Mid(s, i, 1) = " " Then
RichTextBox1.SelStart = i
RichTextBox1.SelLength = InStr(i + 1, s, "|") - (i + 1)
RichTextBox1.SelText = Trim(str(Val(Text15) + 1))
RichTextBox1.saveFile (App.Path & "/print.txt")
Text15 = Val(Text15) + 1
End If
End If
Next i
End If
If Val(Text15) <> 0 Then
RichTextBox1.Text = Format(Now, "dd/mm/yyyy") & "-" & str(Val(Text15) - 1)
RichTextBox1.saveFile (App.Path & "\css.txt")
End If
End Function

Private Function monthlyreport()
Dim con As Connection
Dim cmd As Recordset
Dim aa(5), ac(5), fa(1000), t, dat As String
Dim k, s, tcb, tcr, countplanA(31), countplanC(31), countbondA(31), countbondC(31), countbondB(31), countbondD(31), repFineA(31), repFineC(31), repFine As Integer
Dim aTotal, bTotal, cTotal, dTotal, arTotal(2), crTotal(2), grantTotal As Double
dat = Format(DTPicker2.Value, "m/yyyy")
RichTextBox3.Text = ""
aa(0) = "PlanAMly"
aa(1) = "PlanAQly"
aa(2) = "PlanAHly"
aa(3) = "PlanAYly"
ac(0) = "PlanCMly"
ac(1) = "PlanCQly"
ac(2) = "PlanCHly"
ac(3) = "PlanCYly"
aTotal = bTotal = cTotal = dTotal = grantTotal = 0
Set con = New Connection
con.Provider = "Microsoft.Jet.OLEDB.4.0"
con.Open App.Path & "\Jeevan.mdb"
Set pa = New Connection
pa.Provider = "Microsoft.Jet.OLEDB.4.0"
pa.Open App.Path & "\PlanA.mdb"
Set pc = New Connection
pc.Provider = "Microsoft.Jet.OLEDB.4.0"
pc.Open App.Path & "\PlanC.mdb"
Set c1 = New Connection
c1.Provider = "Microsoft.Jet.OLEDB.4.0"
c1.Open App.Path & "\jeevan.mdb"
'for find date in plan a
For i = 0 To 3
Set rs5 = New Recordset
rs5.CursorLocation = adUseServer
rs5.CursorType = adOpenKeyset
rs5.LockType = adLockOptimistic
rs5.Open "select * from " & aa(i), pa 'for select table from planA
co = Switch(i = 0, 1, i = 1, 3, i = 2, 6, i = 3, 12) 'for count of loop
While Not rs5.EOF
Set cmd = New Recordset
cmd.CursorLocation = adUseServer
cmd.CursorType = adOpenKeyset
cmd.LockType = adLockOptimistic
cmd.Open "Select Inst from customer where JVM='" & rs5!JVM & "'", con
For j = 3 To 58 / co Step 2
varper = Switch(((j / 2) * co <= 13), 20, 1, 5)
If IsNull(rs5.Fields(j)) Or IsEmpty(rs5.Fields(j)) Then Exit For
If Format(rs5.Fields(j), "m/yyyy") = dat Then
If j = 3 Then
countbondA(Val(Format(rs5.Fields(j), "d"))) = countbondA(Val(Format(rs5.Fields(j), "d"))) + ((Val(cmd!Inst) - (Val(cmd!Inst) * (varper / 100))))
aTotal = aTotal + Val(cmd!Inst)
Else
'to check fine amount
If cmd!Inst <> rs5.Fields(j - 1) Then repFineA(Val(Format(rs5.Fields(j), "d"))) = repFineA(Val(Format(rs5.Fields(j), "d"))) + (Val(rs5.Fields(j - 1)) - Val(cmd!Inst))
countplanA(Val(Format(rs5.Fields(j), "d"))) = countplanA(Val(Format(rs5.Fields(j), "d"))) + ((Val(cmd!Inst) - (Val(cmd!Inst) * (varper / 100))))
If varper = 20 Then
arTotal(0) = arTotal(0) + Val(cmd!Inst)
ElseIf varper = 5 Then
arTotal(1) = arTotal(1) + Val(cmd!Inst)
End If
End If
End If
Next j
rs5.MoveNext
Wend
Next i
'for count of planC
For i = 0 To 3
Set rs5 = New Recordset
rs5.CursorLocation = adUseServer
rs5.CursorType = adOpenKeyset
rs5.LockType = adLockOptimistic
rs5.Open "select * from " & ac(i), pc 'for select table from planA
co = Switch(i = 0, 1, i = 1, 3, i = 2, 6, i = 3, 12) 'for count of loop
While Not rs5.EOF
Set cmd = New Recordset
cmd.CursorLocation = adUseServer
cmd.CursorType = adOpenKeyset
cmd.LockType = adLockOptimistic
cmd.Open "Select Inst from customer where JVM='" & rs5!JVM & "'", con
For j = 3 To 118 / co Step 2
varper = Switch(((j / 2) * co <= 13), 20, 1, 5)
If IsNull(rs5.Fields(j)) Or IsEmpty(rs5.Fields(j)) Then Exit For
If Format(rs5.Fields(j), "m/yyyy") = dat Then
If j = 3 Then
countbondC(Val(Format(rs5.Fields(j), "d"))) = countbondC(Val(Format(rs5.Fields(j), "d"))) + ((Val(cmd!Inst) - (Val(cmd!Inst) * (varper / 100))))
cTotal = cTotal + Val(cmd!Inst)
Else
'to check fine amount
If cmd!Inst <> rs5.Fields(j - 1) Then repFineC(Val(Format(rs5.Fields(j), "d"))) = repFineC(Val(Format(rs5.Fields(j), "d"))) + (Val(rs5.Fields(j - 1)) - Val(cmd!Inst))
countplanC(Val(Format(rs5.Fields(j), "d"))) = countplanC(Val(Format(rs5.Fields(j), "d"))) + ((Val(cmd!Inst) - (Val(cmd!Inst) * (varper / 100))))
If varper = 20 Then
crTotal(0) = crTotal(0) + Val(cmd!Inst)
ElseIf varper = 5 Then
crTotal(1) = crTotal(1) + Val(cmd!Inst)
End If
End If
End If
Next j
rs5.MoveNext
Wend
Next i
rs5.Close
rs5.Open "select datecom, amt from customer where planno='PlanB' ", c1
While Not rs5.EOF
If Format(rs5.Fields(0), "m/yyyy") = dat Then
countbondB(Val(Format(rs5.Fields(0), "d"))) = countbondB(Val(Format(rs5.Fields(0), "d"))) + ((Val(rs5.Fields(1)) - (Val(rs5.Fields(1)) * (7 / 100))))
bTotal = bTotal + Val(rs5.Fields(1))
End If
rs5.MoveNext
Wend
rs5.Close
rs5.Open "select datecom from customer where planno='PlanD' ", c1
While Not rs5.EOF
If Format(rs5.Fields(0), "m/yyyy") = dat Then
countbondD(Val(Format(rs5.Fields(0), "d"))) = countbondD(Val(Format(rs5.Fields(0), "d"))) + ((Val(rs5.Fields(1)) - (Val(rs5.Fields(1)) * (7 / 100))))
dTotal = dTotal + Val(rs5.Fields(1))
End If
rs5.MoveNext
Wend

For i = 1 To 31
RichTextBox3.Text = RichTextBox3.Text & i & "==> " & " A- " & countplanA(i) & " C- " & countplanC(i) & " BA- " & countbondA(i) & " BC- " & countbondC(i) & " BB- " & countbondB(i) & " BD- " & countbondD(i) & vbNewLine
Next i

Pag = 1
Printer.ScaleMode = 7
Call monthlyHeader(Pag)
For i = 1 To 31
Printer.Print
Y = Printer.CurrentY
Printer.CurrentX = 0.5
'2
'S.No
X = Printer.CurrentX
Printer.Print i

Printer.CurrentY = Y
Printer.CurrentX = 2
'6
X = Printer.CurrentX
'Per day Amount for Plan A
Printer.Print Switch(countbondA(i) = 0 Or countbondA(i) = Empty, " -", 1, FormatNumber(countbondA(i), 2, vbTrue, vbTrue, vbTrue))

mtcba = mtcba + countbondA(i) 'monthly total collection of bond for planA

Printer.CurrentY = Y
Printer.CurrentX = 4
'9
'Per day Amount for Plan B
Printer.Print Switch(countbondB(i) = 0 Or countbondB(i) = Empty, " - ", 1, FormatNumber(countbondB(i), 2, vbTrue, vbTrue, vbTrue))

mtcbb = mtcbb + countbondB(i) 'monthly total collection of bond for planB

Printer.CurrentY = Y
Printer.CurrentX = 6
'Per day Amount for Plan C
Printer.Print Switch(countbondC(i) = 0 Or countbondC(i) = Empty, " -", 1, FormatNumber(countbondC(i), 2, vbTrue, vbTrue, vbTrue))

mtcbc = mtcbc + countbondC(i) 'monthly total collection of bond for planC

Printer.CurrentY = Y
Printer.CurrentX = 8
'Per day Amount for Plan D
Printer.Print Switch(countbondD(i) = Empty Or countbondD(i) = 0, " -", 1, FormatNumber(countbondD(i), 2, vbTrue, vbTrue, vbTrue))

mtcbd = mtcbd + countbondD(i) 'monthly total collection of bond for planD
'12
tcb = countbondA(i) + countbondB(i) + countbondC(i) + countbondD(i) 'total collect of bond per day

Printer.CurrentY = Y
Printer.CurrentX = 10
'Per day Amount for Bond
Printer.Print Switch(tcb = 0 Or tcb = Empty, " --", 1, FormatNumber(tcb, 2, vbTrue, vbTrue, vbTrue))

Printer.CurrentY = Y
Printer.CurrentX = 12
'Per day Amount for Renewal Plan A
Printer.Print Switch(countplanA(i) = 0 Or countplanA(i) = Empty, " -", 1, FormatNumber(countplanA(i), 2, vbTrue, vbTrue, vbTrue))

mtcpa = mtcpa + countplanA(i) 'monthly total collection of planA

Printer.CurrentY = Y
Printer.CurrentX = 14
'Per day Amount for Renewal Plan C
Printer.Print Switch(countplanC(i) = 0 Or countplanC(i) = Empty, " -", 1, FormatNumber(countplanC(i), 2, vbTrue, vbTrue, vbTrue))

mtcpc = mtcpc + countplanC(i) 'monthly total collection of planC

tcr = countplanA(i) + countplanC(i) + repFineA(i) + repFineC(i) 'total collect of plan per day with fine amount

repFine = repFine + repFineA(i) + repFineC(i) 'total fine amount of the month


mtcb = mtcb + tcb 'monthly collect of bond
mtcr = mtcr + tcr 'monthly collection of renewel

Printer.CurrentY = Y
Printer.CurrentX = 16
'Per day Amount for Renewal
Printer.Print Switch(tcr = 0 Or tcr = Empty, " --", 1, FormatNumber(tcr, 2, vbTrue, vbTrue, vbTrue))

Printer.CurrentY = Y
Printer.CurrentX = 18.5
'Per day Amount total collection
Printer.Print Switch(tcr + tcb = 0 Or tcr + tcb = Empty, FormatNumber(0, 2, vbTrue, vbTrue, vbTrue), 1, FormatNumber((tcr + tcb), 2, vbTrue, vbTrue, vbTrue))

tc = tc + (tcr + tcb)

If i = 31 Then
Printer.Print
Printer.CurrentX = 5
Printer.Print "-------------------------------------------------- * End * ------------------------------------------------------- "
End If

If ((i + 1) Mod 21) = 0 Then

Printer.NewPage
Pag = Pag + 1
Call monthlyHeader(Pag)
End If
Next i

Printer.CurrentY = 24
Printer.Print "_______________________________________________________________________________________________________________________________________________________________________________________________________________"
Printer.Print
Y = Printer.CurrentY

Printer.CurrentY = Y
Printer.CurrentX = 2
'6
X = Printer.CurrentX
Printer.Print FormatNumber(mtcba, 2, vbTrue, vbTrue, vbTrue)

Printer.CurrentY = Y
Printer.CurrentX = 4
'9
Printer.Print FormatNumber(mtcbb, 2, vbTrue, vbTrue, vbTrue)

Printer.CurrentY = Y
Printer.CurrentX = 6
Printer.Print FormatNumber(mtcbc, 2, vbTrue, vbTrue, vbTrue)

Printer.CurrentY = Y
Printer.CurrentX = 8
Printer.Print FormatNumber(mtcbd, 2, vbTrue, vbTrue, vbTrue)
'12

Printer.CurrentY = Y
Printer.CurrentX = 10
Printer.Print FormatNumber(mtcb, 2, vbTrue, vbTrue, vbTrue)


Printer.CurrentY = Y
Printer.CurrentX = 12
Printer.Print FormatNumber(mtcpa, 2, vbTrue, vbTrue, vbTrue)


Printer.CurrentY = Y
Printer.CurrentX = 14
Printer.Print FormatNumber(mtcpc, 2, vbTrue, vbTrue, vbTrue)


Printer.CurrentY = Y
Printer.CurrentX = 16
Printer.Print FormatNumber(mtcr, 2, vbTrue, vbTrue, vbTrue)


Printer.CurrentY = Y
Printer.CurrentX = 18.5
Printer.Print FormatNumber(tc, 2, vbTrue, vbTrue, vbTrue)
Printer.Print "_______________________________________________________________________________________________________________________________________________________________________________________________________________"
Printer.Print
Y = Printer.CurrentY

Printer.CurrentY = Y
Printer.CurrentX = 2
'6
X = Printer.CurrentX
Printer.Print FormatNumber(aTotal, 2, vbTrue, vbTrue, vbTrue)

Printer.CurrentY = Y
Printer.CurrentX = 4
'9
Printer.Print FormatNumber(bTotal, 2, vbTrue, vbTrue, vbTrue)

Printer.CurrentY = Y
Printer.CurrentX = 6
Printer.Print FormatNumber(cTotal, 2, vbTrue, vbTrue, vbTrue)

Printer.CurrentY = Y
Printer.CurrentX = 8
Printer.Print FormatNumber(dTotal, 2, vbTrue, vbTrue, vbTrue)
'12

Printer.CurrentY = Y
Printer.CurrentX = 10
Printer.Print FormatNumber((aTotal + bTotal + cTotal + dTotal), 2, vbTrue, vbTrue, vbTrue)


Printer.CurrentY = Y
Printer.CurrentX = 12
Printer.Print FormatNumber((arTotal(0) + arTotal(1)), 2, vbTrue, vbTrue, vbTrue)


Printer.CurrentY = Y
Printer.CurrentX = 14
Printer.Print FormatNumber((crTotal(0) + crTotal(1)), 2, vbTrue, vbTrue, vbTrue)


Printer.CurrentY = Y
Printer.CurrentX = 16
Printer.Print FormatNumber((arTotal(0) + crTotal(0) + arTotal(1) + crTotal(1)), 2, vbTrue, vbTrue, vbTrue)

grantTotal = aTotal + bTotal + cTotal + dTotal + arTotal(0) + crTotal(0) + arTotal(1) + crTotal(1)
Printer.CurrentY = Y
Printer.CurrentX = 18.5
Printer.Print FormatNumber(grantTotal, 2, vbTrue, vbTrue, vbTrue)
Printer.Print
Printer.Print
Printer.Print
Printer.Print
Y = Printer.CurrentY
Printer.Print "I Year Collection : "; FormatCurrency((aTotal + bTotal + cTotal + dTotal + arTotal(0) + crTotal(0)), 2)
Printer.CurrentY = Y
Printer.CurrentX = 15
Printer.Print "II Year & Above Collection : "; FormatCurrency(arTotal(1) + crTotal(1), 2)
Printer.Print
'Y = Printer.CurrentY
'Printer.Print "Plan C Renewal Amount (I Year) : "; FormatCurrency((cTotal + crTotal(0)), 2)
'Printer.CurrentY = Y
'Printer.CurrentX = 15
'Printer.Print "Plan C Renewal Amount (II Year & Above) : "; FormatCurrency(arTotal(1), 2)
'Printer.Print

Printer.Print "Total Fine Amount : "; FormatCurrency(repFine, 2)
Printer.Print
Y = Printer.CurrentY
X = Printer.CurrentX + 1.5
Printer.Print "Fine Date : "
For i = 1 To 31
Printer.CurrentY = Y

If (X Mod 20) = 0 Then
Y = Y + 1
X = 2
End If

Printer.CurrentX = X
If repFineA(i) + repFineC(i) > 0 Then
Printer.Print i; " - "; FormatCurrency(repFineA(i) + repFineC(i), 2)
X = Printer.CurrentX + 3.5
End If
Next
Printer.EndDoc
End Function

Private Function monthlyHeader(ByVal Pag As Integer)
Printer.CurrentY = 1
Printer.CurrentX = 18
Printer.Print "Page " & Pag
Pag = Pag + 1
Printer.CurrentY = 2
Printer.CurrentX = 6
Printer.Font = "Times New Roman"
Printer.FontBold = True
Printer.FontSize = 14
'Printer.PaintPicture Image1, 5.3, 1.7, 0.9, 0.9
Printer.Print "Jeevan Vaisya Green AgroTech LLP"
Printer.FontBold = False
Printer.FontSize = 10
Printer.CurrentX = 8
Printer.Print "49,49/1, Matha Nilayam,"
Printer.CurrentX = 7
Printer.Print "LIC (Opposite), V.O.C.Road, Karaikudi."
Printer.CurrentX = 8
Printer.Print ""
Printer.Print
Printer.Print
Printer.CurrentX = 8
Printer.Print "Monthly Report Form"
Printer.FontSize = 9
Printer.CurrentY = 5
Printer.CurrentX = 0.5
Printer.Print "Report Month & Year: " & Mid(datechange(DTPicker2.Value), 4, 10)
Printer.CurrentY = 5
Printer.CurrentX = 15.5
Printer.Print "Date: " & Mid(datechange(Now), 4, 10) & " " & Format(Now, "hh:mm AM/PM")
Printer.Print "_______________________________________________________________________________________________________________________________________________________________________________________________________________"
'1
Printer.CurrentY = 6.5
Printer.CurrentX = 0.5
'2
X = Printer.CurrentX
Printer.Print "Date"

Printer.CurrentY = 6
Printer.CurrentX = 5
Printer.Print "Bond"

Printer.CurrentY = 6.5
Printer.CurrentX = 18.5
Printer.Print "Total Collection"

Printer.CurrentY = 6.3
Printer.CurrentX = 2
Printer.Line (2, 6.6)-(10.5, 6.6)

Printer.CurrentY = 7
Printer.CurrentX = 2
'6
X = Printer.CurrentX
Printer.Print "Plan A"

Printer.CurrentY = 7
Printer.CurrentX = 4
'9
Printer.Print "Plan B"

Printer.CurrentY = 7
Printer.CurrentX = 6
Printer.Print "Plan C"

Printer.CurrentY = 7
Printer.CurrentX = 8
Printer.Print "Plan D"
'12

Printer.CurrentY = 7
Printer.CurrentX = 10
Printer.Print "Total"



Printer.CurrentY = 6
Printer.CurrentX = 13.8
Printer.Print "Renewal"

Printer.Line (12, 6.6)-(16.8, 6.6)
X = Printer.CurrentX
'Printer.Print "Signature"
'20

Printer.CurrentY = 7
Printer.CurrentX = 12
Printer.Print "Plan A"

Printer.CurrentY = 7
Printer.CurrentX = 14
Printer.Print "Plan C"

'18
Printer.CurrentY = 7
Printer.CurrentX = 16
Printer.Print "Total"


Printer.Print "_______________________________________________________________________________________________________________________________________________________________________________________________________________"
Printer.Print
End Function

Private Function reprint(ByVal custId As String)
Dim startPoint, paidPoint, finePoint, amtPoint, balPoint, due As Integer
Dim fineTotal, paidTotal, paidAmt, balFine, dueDay As Long
Dim dueDate, dateComm, payableDate, payingDate As Date
Dim custName, custCode As String
c.Open App.Path & "\Jeevan.mdb"
rs6.Open "Select * from Customer Where JVM='" & custId & "'", c
prPlanNo = rs6!planNo
prMop = rs6!mop
prAmt = rs6!Inst
prTotalAmt = rs6!Amt
custName = rs6!Name
dueDate = rs6!datecom
custCode = Switch((rs1!branch <> "" Or rs1!branch <> Null), rs1!branch, 1, "JVM") & rs6!JVM
rs6.Close
c.Close
c.Open App.Path & "/" & prPlanNo & ".mdb"
rs6.Open "Select * from " & prPlanNo & prMop & " Where JVM='" & custId & "'", c
Printer.ScaleMode = 7
Printer.CurrentX = 7
Printer.CurrentY = 2
Printer.Print "Jeevan Vaisya Green AgroTech LLP"
Printer.FontBold = False
Printer.FontSize = 10
Printer.CurrentX = 5
Printer.Print "Regd. off: A-46, Suburaman Street West, Gandhiji Main Road,"
Printer.CurrentX = 7
Printer.Print "Thirunagar 1st Stop, Madurai - 625006."
Printer.CurrentX = 8
Printer.Print "Ph: 0452-4367415,4367416."
Printer.Print
Printer.Print
Printer.CurrentX = 9
Printer.Print "Policy Detail"
Printer.Print
Y = Printer.CurrentY
Printer.CurrentX = 3
Printer.Print "Name : "; custName
Printer.CurrentY = Y
Printer.CurrentX = 15
Printer.Print "Policy No. : "; custCode
Printer.Print
Y = Printer.CurrentY
Printer.CurrentX = 3
Printer.Print "Plan & Term : "; prPlanNo
Printer.Print
Printer.CurrentY = Y
Printer.CurrentX = 15
Printer.Print "Mode : "; prMop
Printer.Print
Y = Printer.CurrentY
Printer.CurrentX = 3
Printer.Print "Consideration : "; prTotalAmt
Printer.CurrentY = Y
Printer.CurrentX = 15
Printer.Print "Due Amount : "; prAmt
Printer.Print
Y = Printer.CurrentY
Printer.CurrentX = 3
dueDay = Day(dueDate)
Printer.Print "Due Date : On or Before "; dueDay; Switch(Mid(dueDay, Len(dueDay) - 1, 1) = 1, "st", Mid(dueDay, Len(dueDay) - 1, 1) = 2, "nd", Mid(dueDay, Len(dueDay) - 1, 1) = 3, "rd", 1, "th"); " of Every Month"
'Printer.CurrentY = Y
'Printer.CurrentX = 15
'Printer.Print "Land : "; Round(prAmt / 20, 2); "Sq. Ft."
Printer.Line (0, Printer.CurrentY)-(Printer.ScaleWidth, Printer.CurrentY)
Printer.Print
Y = Printer.CurrentY
startPoint = 3
Printer.CurrentX = startPoint
Printer.Print "S.No."

'Printer.CurrentY = Y
'startPoint = startPoint + 2
'Printer.CurrentX = startPoint
'Printer.Print "CSS No."

startPoint = startPoint + 2.5
Printer.CurrentX = startPoint
Printer.CurrentY = Y
Printer.Print "Amount"

startPoint = startPoint + 2.5
Printer.CurrentX = startPoint
Printer.CurrentY = Y
Printer.Print "Paid Amount"

startPoint = startPoint + 2.75
Printer.CurrentX = startPoint
Printer.CurrentY = Y
Printer.Print "Paid Date"

startPoint = startPoint + 2.75
Printer.CurrentX = startPoint
Printer.CurrentY = Y
Printer.Print "Fine"

startPoint = startPoint + 2
Printer.CurrentX = startPoint
Printer.CurrentY = Y
Printer.Print "Paid Fine"

startPoint = startPoint + 2
Printer.CurrentX = startPoint
Printer.CurrentY = Y
Printer.Print "Balance Fine"
Printer.Print
Printer.Line (0, Printer.CurrentY)-(Printer.ScaleWidth, Printer.CurrentY)
Printer.Print
Y = Printer.CurrentY
j = 1

dateComm = rs6.Fields(3)
fineAmt = 0
For i = 2 To rs6.Fields.Count - 1 Step 2
If Not IsNull(rs6.Fields(i)) Or rs6.Fields(i) <> "" Then
payableDate = DateAdd("m", due * Int(Switch(prMop = "Mly", 1, prMop = "Qly", 3, prMop = "Hly", 6, prMop = "Yly", 12)), dateComm)
payingDate = rs6.Fields(i + 1)
fineAmt = monthlyFine(payableDate, payingDate, prAmt)
fineTotal = fineTotal + Val(fineAmt)
paidFine = paidFine + (rs6.Fields(i) - prAmt)
balFine = fineTotal - paidFine
paidAmt = paidAmt + prAmt
due = due + 1

'Print Serial Number
startPoint = 3
Printer.CurrentX = startPoint
Printer.CurrentY = Y
Printer.Print j

'startPoint = startPoint + 2.25
'Printer.CurrentY = Y
'Printer.CurrentX = startPoint
'Printer.Print CInt(Int((50 * Rnd()) + 1))

'Print Due Amount
Printer.CurrentY = Y
startPoint = startPoint + 2.5
amtPoint = startPoint
Printer.CurrentX = startPoint
Printer.Print prAmt;

'Print Total Paid Amount
Printer.CurrentY = Y
startPoint = startPoint + 2.5
Printer.CurrentX = startPoint
'Printer.Print Format(prDueDate, "dd-mmm-yyyy");
Printer.Print paidAmt;

'Due Date
Printer.CurrentY = Y
startPoint = startPoint + 2.75
Printer.CurrentX = startPoint
Printer.Print Format(rs6.Fields(i + 1), "dd-mm-yyyy");

'Fine Amount
Printer.CurrentY = Y
startPoint = startPoint + 3
finePoint = startPoint
Printer.CurrentX = startPoint
Printer.Print fineAmt

'Paid Fine Amount
Printer.CurrentY = Y
startPoint = startPoint + 2.5
paidPoint = startPoint
Printer.CurrentX = startPoint
Printer.Print rs6.Fields(i) - prAmt

'To Be Paid Fine Amount
Printer.CurrentY = Y
startPoint = startPoint + 2.5
balPoint = startPoint
Printer.CurrentX = startPoint
Printer.Print balFine & vbNewLine
Y = Printer.CurrentY
j = j + 1
If j Mod 20 = 0 Then
Printer.NewPage
Y = 2
End If
Else
Exit For
End If
Next
Printer.Line (0, Printer.CurrentY)-(Printer.ScaleWidth, Printer.CurrentY)
Printer.Print
'Y = Printer.CurrentY
'Printer.CurrentX = amtPoint - 0.27
'Printer.Print paidAmt
'Printer.CurrentY = Y
'Printer.CurrentX = finePoint
'Printer.Print fineTotal
'Printer.CurrentY = Y
'Printer.CurrentX = paidPoint
'Printer.Print paidFine
'Printer.CurrentY = Y
'Printer.CurrentX = balPoint - 0.27
'Printer.Print balFine
'Printer.Print
'Printer.Line (0, Printer.CurrentY)-(Printer.ScaleWidth, Printer.CurrentY)
'Printer.Print
Printer.Print "Total Amount Paid : "; paidAmt; vbNewLine
Printer.Print "Fine To Be Paid : "; fineTotal; vbNewLine
Printer.Print "Paid Fine Amount : "; paidFine; vbNewLine
Printer.EndDoc
rs6.Close
c.Close
End Function

Private Function isFine(ByVal firstDue As Date, ByVal thisDue As Date, ByVal dueNo As Integer) As Long
Dim diff As Long
prDueDate = DateAdd("m", dueNo - Switch(prMop = "Mly", 1, prMop = "Qly", 3, prMop = "Hly", 6, prMop = "Yly", 12), firstDue)
diff = DateDiff("d", thisDue, prDueDate)
isFine = Switch(diff < -15, 5, 1, 0)
End Function
